# This code is part of the MWP System
# Copyright (c) 2012 Benjamin Lubin (blubin@bu.com) 
# Published under and subject to the GPLv2 license available at http://www.gnu.org/licenses/gpl-2.0.html

'''
Created on Dec 14, 2012
@author: blubin
'''

from frontend.roleApplication import RoleApplication;
from frontend.form import Type;
from unique import UNIQUE;

class DesignerApplication(RoleApplication):
    """ The Designer User Interface """

    def __init__(self):
        super(DesignerApplication, self).__init__("CharacterCreation"+UNIQUE, "Designer");
        self.register_source_step("CreateConcept", self.create_concept_form_creator);
        self.register_transition_step("ReviseConcept", self.revise_concept_form_creator, name_fields=["Name"]);

    def create_concept_form_creator(self, stepname, form):
        form.add_html_label('<B>Enter Character Information:</B>')
        form.add_field(Type.SHORTSTRING, "Name", labeltext="Name");
        form.add_field(Type.SHORTSTRING, "Description", labeltext="Description");
        form.add_field(Type.CHOICE, "CharacterType", labeltext="Character Type", choices=['Human', 'Animal', 'Object'], initial='Human');
        form.add_field(Type.CHOICE, "ColorScheme", labeltext="Color Scheme", choices=['Black and Gold', 'Purple and Gold', 'Green and Yellow'], initial='Black and Gold');
    
    def revise_concept_form_creator(self, stepname, form):
        form.add_html_label('<B>Revise Character Information:</B>')
        data = form.task.data
        form.add_field(Type.SHORTSTRING, "Name", labeltext="Name", initial=data['name']);
        form.add_field(Type.SHORTSTRING, "Description", labeltext="Description", initial=data['description']);
        form.add_field(Type.CHOICE, "CharacterType", labeltext="Character Type", choices=['Human', 'Animal', 'Object'], initial=data['charactertype']);
        form.add_field(Type.CHOICE, "ColorScheme", labeltext="Color Scheme", choices=['Black and Gold', 'Purple and Gold', 'Green and Yellow'], initial=data['colorscheme']);
    
if __name__ == '__main__':
    app = DesignerApplication();
    app.MainLoop();